/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package rn;

import controladores.ImpresoraJpaController;
import entidades.Impresora;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

/**
 *
 * @author g
 */
public class ConfiguracionRN {
    
    private static EntityManagerFactory factory = Persistence.createEntityManagerFactory("Hormicat-SistemaIntegralPU");
    private static ImpresoraJpaController impresoraJpaController = new ImpresoraJpaController(factory);
    
    public static void create(Impresora printer){
        impresoraJpaController.create(printer);
    }
    
    public static void edit(Impresora printer){
        try {
            impresoraJpaController.edit(printer);
        } catch (Exception ex) {
            Logger.getLogger(ConfiguracionRN.class.getName()).log(Level.SEVERE, null, ex);
        }
    }    
    
    public static List<Impresora> getTodosImpresoras(){
        return impresoraJpaController.findImpresoraEntities();
    }
    
    public static boolean yaExisteMacConImpresora(String value){
        return impresoraJpaController.yaExisteMacConImpresora(value);
    }
    
    public static Impresora getImpresoraXMac(String mac) { 
        return impresoraJpaController.getImpresoraXMac(mac);
    }
    
}
